SDXL
Embeddings are vector representations of words or phrases. In textual inversion, embeddings are used to capture the semantic meaning of the new concept or style that you want to teach the model. The model learns to associate the embedding with the example images, allowing it to generate images that are consistent with the concept or style.
To use embeddings, you will need to mention the ID of the embeddings model in model_id and you will need to include the trigger words from the embedding model in the prompt.
- You can pass the words in the negative and/or the positive prompt based on how the model was trained.
- Embeddings models can be used for text2image, image2image and inpainting tasks.
- Text2Image
- Image2Image
- Inpainting
- Python
- JavaScript
- PHP
import requests
import json
url = "https://api.imagepipeline.io/sdxl/text2image/v1"
headers = {
"API-Key": "Your API Key"
}
data = {
"model_id": "sdxl",
"prompt": "Close up of beautiful young woman with red hair, detailed eyes、detailed face, detailed skin, standing in a field of wildflowers, wearing a flowing white dress, cinematic-2, 8k quality",
"negative_prompt": "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, blurry face, bad proportion, (deformed iris), too many fingers",
"num_inference_steps": 20,
"refiner": false,
"samples": 1,
"guidance_scale": 7.5,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
const url = "https://api.imagepipeline.io/sdxl/text2image/v1";
const headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
};
const data = {
"model_id": "sdxl",
"prompt": "Close up of beautiful young woman with red hair, detailed eyes、detailed face, detailed skin, standing in a field of wildflowers, wearing a flowing white dress, cinematic-2, 8k quality",
"negative_prompt": "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, blurry face, bad proportion, (deformed iris), too many fingers",
"num_inference_steps": 20,
"refiner": false,
"samples": 1,
"guidance_scale": 7.5,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/sdxl/text2image/v1";
$headers = array(
"API-Key: Your-API-Key",
"Content-Type: application/json"
);
$data = array(
"model_id"=> "sdxl",
"prompt"=> "Close up of beautiful young woman with red hair, detailed eyes、detailed face, detailed skin, standing in a field of wildflowers, wearing a flowing white dress, cinematic-2, 8k quality",
"negative_prompt"=> "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, blurry face, bad proportion, (deformed iris), too many fingers",
"num_inference_steps"=> 40,
"refiner"=> false,
"samples"=> 1,
"guidance_scale"=> 7.5,
"width"=> 768,
"height"=> 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed"=> 12345,
"safety_checker"=> true
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
- Python
- JavaScript
- PHP
import requests
import json
url = "https://api.imagepipeline.io/sdxl/image2image/v1"
headers = {
"API-Key": "Your API Key"
}
data = {
"model_id": "sdxl",
"init_image": "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt": "ethereal fantasy concept art of woman with crown of beautiful flowers, 8k quality, majestic, magical, fantasy art, cover art, dreamy",
"negative_prompt": "ac_neg1, photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, ((deformed eyes)), glitch, noise, noisy, off-center, deformed, ((cross-eyed)), bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
"num_inference_steps": 45,
"refiner": true,
"samples": 1,
"guidance_scale": 10,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
const url = "https://api.imagepipeline.io/sdxl/image2image/v1";
const headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
};
const data = {
"model_id": "sdxl",
"init_image": "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt": "ethereal fantasy concept art of woman with crown of beautiful flowers, 8k quality, majestic, magical, fantasy art, cover art, dreamy",
"negative_prompt": "ac_neg1, photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, ((deformed eyes)), glitch, noise, noisy, off-center, deformed, ((cross-eyed)), bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
"num_inference_steps": 45,
"refiner": true,
"samples": 1,
"guidance_scale": 10,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/sdxl/image2image/v1";
$headers = array(
"API-Key: Your-API-Key",
"Content-Type: application/json"
);
$data = array(
"model_id"=> "sdxl",
"init_image"=> "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt"=> "ethereal fantasy concept art of woman with crown of beautiful flowers, 8k quality, majestic, magical, fantasy art, cover art, dreamy",
"negative_prompt"=> "ac_neg1, photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, ((deformed eyes)), glitch, noise, noisy, off-center, deformed, ((cross-eyed)), bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
"num_inference_steps"=> 45,
"refiner"=> true,
"samples"=> 1,
"guidance_scale"=> 10,
"width"=> 768,
"height"=> 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed"=> 12345,
"safety_checker"=> true
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
- Python
- JavaScript
- PHP
import requests
import json
url = "https://api.imagepipeline.io/sdxl/inpainting/v1"
headers = {
"API-Key": "Your API Key"
}
data = {
"model_id": "sdxl",
"mask_image": "https://docs.imagepipeline.io/img/sdxl_maskimg.png",
"init_image": "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt": "The woman is holding flowers, royalty, fantasy art, 8k quality",
"negative_prompt": "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, ((fused fingers)), bad hands, (((too many fingers))), (((deformed hands))), disproportional hands",
"num_inference_steps": 20,
"refiner": false,
"samples": 1,
"guidance_scale": 10,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
const url = "https://api.imagepipeline.io/sdxl/inpainting/v1";
const headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
};
const data = {
"model_id": "sdxl",
"mask_image": "https://docs.imagepipeline.io/img/sdxl_maskimg.png",
"init_image": "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt": "The woman is holding flowers, royalty, fantasy art, 8k quality",
"negative_prompt": "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, ((fused fingers)), bad hands, (((too many fingers))), (((deformed hands))), disproportional hands",
"num_inference_steps": 20,
"refiner": false,
"samples": 1,
"guidance_scale": 10,
"width": 768,
"height": 768,
"embeddings" : "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed": 12345,
"safety_checker": true
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/sdxl/inpainting/v1";
$headers = array(
"API-Key: Your-API-Key",
"Content-Type: application/json"
);
$data = array(
"model_id"=> "sdxl",
"mask_image"=> "https://docs.imagepipeline.io/img/sdxl_maskimg.png",
"init_image"=> "https://docs.imagepipeline.io/img/sdxl_img2img.png",
"prompt"=> "The woman is holding flowers, royalty, fantasy art, 8k quality",
"negative_prompt"=> "ac_neg1, error, cropped, worst quality, low quality, duplicate, blurry, (unfinished objects), stock image, artifacts, ((fused fingers)), bad hands, (((too many fingers))), (((deformed hands))), disproportional hands",
"num_inference_steps"=> 40,
"refiner"=> false,
"samples"=> 1,
"guidance_scale"=> 10,
"width"=> 768,
"height"=> 768,
"embeddings"=> "15f002de-bf0c-4b99-857b-a7a4bd7030dc",
"seed"=> 12345,
"safety_checker"=> true
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
JSON Parameters
Parameter | Permissible values | Notes |
---|---|---|
model_id | str | model_id can be found in models page. Filter by SDXL models |
prompt | str, 75 tokens | Check our Prompt Guide for tips. Please add embeddings prompts to your prompt |
negative_prompt | str, 75 tokens | Check our Prompt Guide for tips. Please add embeddings prompts to your prompt |
num_inference_steps | int, [1-100] | Noise is removed with each step, resulting in a higher-quality image over time. Ideal value 20-30 |
strength | float, [0-1] | Optional denoise strength |
samples | int, [1-4] | Generates a maximum of 4 samples per API call |
guidance_scale | float, [1-20] | Higher guidance scale prioritizes text prompt relevance but sacrifices image quality. Ideal value 7.5-12.5 |
width | int | Width in pixels. Higher than or equal to 768 for best results |
height | int | Height in pixels. Higher than or equal to 768 for best results |
seed | int | Controlling the seed can help you generate reproducible images |
embeddings | str | Pass the model_id of embeddings models that can be found in models page |
safety_checker | boolean | Checks for NSFW images and filters explicit images |
Status
Your response will include a status
.
- If the
status
=SUCCESS
, you will also havedownload_urls
that will have the links to your generated image based on the number of samples you have entered. The maximum number of samples that can be generated is 4. - If the
status
=PENDING
, you will receive aid
. You can use the status endpoint to fetch your image using theid
. - If the
status
=FAILURE
, you will receive only an error message.
Use the respective endpoint to fetch the status:
-
https://api.imagepipeline.io/sdxl/text2image/v1/status/{{id}}
-
https://api.imagepipeline.io/sdxl/image2image/v1/status/{{id}}
-
https://api.imagepipeline.io/sdxl/inpainting/v1/status/{{id}}
Pass the API-Key as the authorization in the header.